package com.xyd.service.impl;

import com.xyd.entity.Admin;
import com.xyd.mapper.AdminMapper;
import com.xyd.service.AdminService;
import com.xyd.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

/**
 * @author 86186
 */
public class AdminServletImpl implements AdminService {
    SqlSession sqlSession=null;

    @Override
    public Admin LoginAdmin(String eaName, String eaPassword) {
        sqlSession= MybatisUtil.getSqlSession();
        Admin admin=sqlSession.getMapper(AdminMapper.class).LoginAdmin(eaName,eaPassword);
        sqlSession.commit();
        MybatisUtil.closeSqlSession(sqlSession);
        return admin;
    }

    @Override
    public Boolean RegAdmin(Admin admin) {
        sqlSession=MybatisUtil.getSqlSession();

        Boolean flag=sqlSession.getMapper(AdminMapper.class).RegAdmin(admin);
        sqlSession.commit();
        MybatisUtil.closeSqlSession(sqlSession);
        return flag;
    }
}
